using System;
using System.Collections.Generic;
using System.Text;

namespace GraphFS
{
	public struct GeoPoint
	{
		public static GeoPoint Empty=new GeoPoint(0,0);
		public double Lat;
		public double Lon;
		public GeoPoint(double lat, double lon)
		{
			this.Lat = lat;
			this.Lon = lon;

		}


		public override string ToString()
		{
			return String.Format("GeoPoint {{ {0},{1} }}", Lat, Lon);
		}


		public static GeoPoint operator +(GeoPoint a, GeoPoint b)
		{
			GeoPoint ret;
			ret.Lat = a.Lat + b.Lat;
			ret.Lon = a.Lon + b.Lon;
			return ret;
		}
		public static GeoSize operator -(GeoPoint a, GeoPoint b)
		{
			GeoSize ret=new GeoSize(a.Lat - b.Lat,a.Lon - b.Lon);
			return ret;
		}

		public static double operator ^(GeoPoint a, GeoPoint b) //squared distance
		{
			GeoSize dif = (a - b);
			return Math.Pow(dif.Width, 2) + Math.Pow(dif.Height, 2);
			
		}
		public static double operator %(GeoPoint a, GeoPoint b) //distance
		{
			return Math.Sqrt(a ^ b);
			
		}

	}
}
